<?php
include("include/conn.php");
 
$updatevepaaribillmaster = "UPDATE vepaaribilldetail
                               SET billDone = 'N'
                             WHERE vepaariBookMasterId IN (SELECT vepaariBookMasterId 
                                                            FROM vepaaribillmaster 
                                                           WHERE partyId = ".$_POST['party'].")";
$updatevepaaribillmasterRes = mysql_query($updatevepaaribillmaster);

$updatevepaaribilldetail = "UPDATE vepaaribilldetail
                               SET billBookNo = 0
                             WHERE vepaariBookMasterId IN (SELECT vepaariBookMasterId 
                                                            FROM vepaaribillmaster 
                                                           WHERE partyId = ".$_POST['party'].")";
$updatevepaaribilldetailRes = mysql_query($updatevepaaribilldetail);
     	
$query1 = "DELETE FROM vepaaribillmaster
            WHERE billNo IN (SELECT billNo FROM billbook WHERE billBookId = '".$_REQUEST['billBookId']."')";
$result1=mysql_query($query1);

$query1 = "DELETE FROM billbook
            WHERE billbookid IN (".$_REQUEST['billBookId'].")";
$result1=mysql_query($query1);

$query2 = "DELETE FROM billbookdetail
            WHERE billbookid IN (".$_REQUEST['billBookId'].")";
$result2=mysql_query($query2);
header("Location:billBookList.php");
 ?>